home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / basic / PureBasic.lha / PureBasic_1.60_Demo / Extras / CygnusEd / PB_GetSyntax.ced < prev    next >
Encoding:
Text File  |  2000-09-10  |  3.3 KB  |  127 lines

  1. /* $VER: PB_GetSyntax.ced ENG 1.0 (03-Sep-2000) by A.Greve */
  2.  
  3. sourcepath = 'PureBasic:Projects'
  4. cedname    = 'CED:Ed'
  5. temp_s     = 'T:pb_srch.txt'
  6. temp_l     = 'T:pb_link.txt'
  7. fkey1      = 1
  8.  
  9. /**********************************************************/
  10.  
  11. cedscript1 = 'PureBasic:Extras/CygnusEd/PB_GetSyntax.ced'
  12. indexfile  = 'PureBasic:Help/IndexAll.guide'
  13. lf = '0a'x; qu = '22'x
  14. link = '@{'qu
  15.  
  16. IF sourcepath == 'SOURCEPATH' THEN sourcepath = 'PureBasic:'
  17. IF cedname    == 'CEDNAME'    THEN cedname    = 'ed'
  18. IF temp_s     == 'TEMP_S'     THEN temp_s     = 'T:pb_srch.txt'
  19. IF temp_l     == 'TEMP_L'     THEN temp_l     = 'T:pb_link.txt'
  20. IF (fkey1 < 1) | (fkey1 > 10) | (fkey1 == 'FKEY1') THEN fkey1 = 1
  21.  
  22. OPTIONS RESULTS
  23.  
  24. IF ADDRESS() = 'REXX' THEN DO
  25.     IF SHOW(p,'CYGNUSED') THEN InstScript()
  26.     ELSE DO
  27.         IF ~SHOW('L','rexxsupport.library') THEN DO
  28.             IF ~ADDLIB('rexxsupport.library',10,-30,0) THEN DO
  29.                 SAY 'Couldn''t open <rexxsupport.library> !'
  30.                 EXIT(0)
  31.             END
  32.         END
  33.         IF ~SHOW('L','rexxtricks.library') THEN DO
  34.             IF ~ADDLIB('rexxtricks.library',10,-30,0) THEN DO
  35.                 SAY 'Couldn''t open <rexxtricks.library> !'
  36.                 EXIT(0)
  37.             END
  38.         END
  39.         IF ~SHOW('L','rexxreqtools.library') THEN DO
  40.             IF ~ADDLIB('rexxreqtools.library',10,-30,0) THEN DO
  41.                 SAY 'Couldn''t open <rexxreqtools.library> !'
  42.                 EXIT(0)
  43.             END
  44.         END
  45.         IF ~SHOW('L','amigaguide.library') THEN DO
  46.             IF ~ADDLIB('amigaguide.library',10,-30,0) THEN DO
  47.                 SAY 'Couldn''t open <amigaguide.library> !'
  48.                 EXIT(0)
  49.             END
  50.         END
  51.  
  52.         filename = RTFILEREQUEST(sourcepath,,'Please select a PureBasic script...',,,
  53.                       'rtfi_matchpat=#?.pb rtfi_flags=freqf_patgad')
  54.         IF filename ~= '' THEN ADDRESS COMMAND cedname' 'filename
  55.  
  56.         IF READFILE(indexfile, 'index') THEN DO
  57.             j = 0
  58.             DO i = 1 TO index.0
  59.                 IF WORD(index.i, 1) = link THEN DO
  60.                     j = j + 1
  61.                     indsrch.j = WORD(index.i, 2)
  62.                     tmp = WORD(index.i, 5)
  63.                     indlink.j = LEFT(tmp, LENGTH(tmp) - 1)
  64.                     indlink.j = CENTER(indlink.j, LENGTH(indlink.j) - 2)
  65.                 END
  66.             END
  67.             DROP index.
  68.             indsrch.0 = j; indlink.0 = j
  69.             IF ~WRITEFILE(temp_s, 'indsrch') THEN DO
  70.                 SAY 'Couldn''t create <'temp_s'> !'
  71.                 EXIT(0)
  72.             END
  73.             IF ~WRITEFILE(temp_l, 'indlink') THEN DO
  74.                 SAY 'Couldn''t create <'temp_l'> !'
  75.                 EXIT(0)
  76.             END
  77.         END
  78.         ELSE DO
  79.             SAY 'Couldn''t open <'indexfile'> !'
  80.             EXIT(0)
  81.         END
  82.  
  83.         InstScript()
  84.         EXIT(0)
  85.     END
  86. END
  87.  
  88. ADDRESS COMMAND 'Version >NIL: amigaguide.library 40'
  89. aguidever = RC
  90.  
  91. IF ~READFILE(temp_s, 'indsrch') THEN DO
  92.     SAY 'Couldn''t open <'temp_s'> !'
  93.     EXIT(0)
  94. END
  95. IF ~READFILE(temp_l, 'indlink') THEN DO
  96.     SAY 'Couldn''t open <'temp_l'> !'
  97.     EXIT(0)
  98. END
  99.  
  100. CEDTOFRONT
  101. GETWORD
  102. theword = RESULT
  103. IF theword ~= 0 THEN DO
  104.     IF FIND('B L S UB UL UW W', UPPER(theword)) > 0 THEN DO
  105.         LEFT
  106.         GETWORD
  107.         IF RESULT = '.' THEN theword = '.'theword
  108.         RIGHT
  109.     END
  110.     num = RXTR_LSEARCH(theword, 'indsrch', 1)
  111.        IF num > 0 THEN DO
  112.         IF aguidever = 5 THEN
  113.             CALL SHOWNODE('CygnusEdScreen1', RXTR_PATHPART(indlink.num), RXTR_FILEPART(indlink.num),)
  114.         ELSE
  115.             CALL SHOWNODE('CygnusEdScreen1', RXTR_PATHPART(indlink.num), RXTR_FILEPART(indlink.num),,)
  116.     END
  117.     ELSE OKAY1 'Couldn''t get information about'lf'<'theword'> !'
  118. END
  119. EXIT(0)
  120.  
  121. InstScript:
  122.     ADDRESS 'CYGNUSED'
  123.     IF EXISTS(cedscript1) THEN "INSTALL DOS/AREXX COMMAND" fkey1 cedscript1
  124.     ELSE SAY 'Couldn''t find and install <'cedscript1'> !'
  125. RETURN 0
  126.  
  127.